#include<iostream>
#include"Udpserver.hpp"
#include"task.hpp"

int main(int argc,char *argv[])
{
    if(argc != 2)
    {
        LOG(level::ERROR)<<"you should: "<<argv[0]<<" port";
        exit(1);
    }
    uint16_t port = std::stoi(argv[1]);
    Task task;
    //using task_t = bind()
    std::unique_ptr<udpserve> uptrser = std::make_unique<udpserve>(port,[&task](const int& sfd,const Inetaddr& addr,const std::string message){
        task.route(sfd,addr,message);
    });

    uptrser->init();
    uptrser->start();
    
    // std::unique_ptr<udpserve> uptrser = std::make_unique<udpserve>(port,[](){
    //     std::cout<<"hello"<<std::endl;
    // });



    return 0;
}